import request from '../request/request';


// 攻略列表
export const fetchStrategyList = (scenicId) => {
  return request({
    url: '/intro/index',
    method: 'post',
    data: { scenic_id: scenicId },
  });
};

// 获取收藏点赞数据
export const fetchCollectData = (userId, type) => {
  return request({
    url: '/Collect/index',
    method: 'post',
    data: { user_id: userId, type },
  });
};

// 删除收藏项
export const deleteCollectItem = (id) => {
  return request({
    url: '/Collect/del',
    method: 'post',
    data: { id },
  });
};
// 获取全部点赞收藏数据
export const fetchAllCollectData = (userId) => {
  return Promise.all([
    fetchCollectData(userId, 1),
    fetchCollectData(userId, 3)
  ]).then(([collectRes, likeRes]) => {
    const collectData = collectRes.data || [];
    const likeData = likeRes.data || [];
    const allData = [...collectData, ...likeData];
    const uniqueMap = new Map();
    allData.forEach(item => uniqueMap.set(item.id, item));
    return Array.from(uniqueMap.values());
  });
};